for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
import { Component, ReactNode } from 'react'
import { Button, Text } from 'shared/ui'
interface IState {
error: null | Error
}
interface IProps {
children: ReactNode
class ErrorBoundary extends Component<IProps, IState> {
state = { error: null }
static getDerivedStateFromError(error: Error) {
return { error }
componentDidCatch(error: Error, errorInfo: any) {
console.error('From ErrorBoundary:', error, errorInfo)
render() {
if (this.state.error) {
return (
<div className="flex flexCol flexAlCent">
<Text className="mb32 mt32" tag="h2">
tag
Something went wrong
</Text>
<Button onClick={() => window.history.go()}>
<Text tag="span">Refresh Page</Text>
Refresh Page
</Button>
</div>
)
return this.props.children
export { ErrorBoundary }